package d1_com.itheima.collection;

import java.util.HashSet;
import java.util.Set;

public class HashSetDemo {
    public static void main(String[] args) {
        Set<Student> set = new HashSet<>();
        Student s1 = new Student("猪八戒", 111);
        Student s2 = new Student("猪八戒", 111);
        Student s3 = new Student("孙悟空", 2500);
        Student s4 = new Student("沙僧", 300);
        Student s5 = new Student("唐僧", 200);
        //重写哈希值
        System.out.println(s1.hashCode());
        System.out.println(s2.hashCode());

        set.add(s1);
        set.add(s2);
        set.add(s3);
        set.add(s4);
        set.add(s5);
        System.out.println(set);
    }
}
